f2 = open('eeekb.txt', 'r')
s1 = set()
for l in f2:
    k = l.strip()
    s1.add(k)
f2.close()

f1 = open('kb.txt', 'r')
content = []
innum = 0
for l in f1:
    k = l.strip().split('\t')[0]
    if k not in s1:
        content.append(l.strip())
    else:
        print l.strip().decode('utf-8').encode('cp936')
        innum += 1
f1.close()

f = open('ikb.txt', 'w')
f.write('\n'.join(content))
f.close()

print innum, "already imported"
